<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Ovio -  Bootstrap Based Responsive Dashboard &amp; Admin Template</title>

<!-- Bootstrap -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">

<!-- Google Font -->
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet">

<!-- Template style -->
<link rel="stylesheet" href="dist/css/style.css">
<link rel="stylesheet" href="dist/et-line-font/et-line-font.css">
<link rel="stylesheet" href="dist/font-awesome/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="dist/weather/weather-icons.min.css">
<link type="text/css" rel="stylesheet" href="dist/weather/weather-icons-wind.min.css">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

<script src="plugins/charts/code/highcharts.js"></script>
</head>

<body class="sidebar-mini">
<div class="wrapper">

    <!-- 引入顶栏 -->
  <header class="main-header dark-bg">

        <!-- Logo -->
        <a href="index.html" class="logo dark-bg">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><img src="dist/img/logo.png" alt="Ovio"></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><img src="dist/img/logo-lg.png" alt="Ovio"></span> </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button"> <span class="sr-only">Toggle navigation</span>
            </a>


            <!--右侧顶栏，以后要统一，以index页面的为准-->
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">


                    <!--邮箱登录-->
                    <li class="dropdown notifications-menu"><a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="icon-envelope"></i>
                        <div class="notify"><span class="heartbit noticePoint"></span> <span
                                class="point noticePoint"></span></div>
                    </a>
                        <ul class="dropdown-menu">
                            <li class="header" style="text-align: center"><span>请输入您的邮箱和授权码</span><br/>
                                <span>--（目前仅支持QQ邮箱）--</span></li>
                            <li>
                                <input type="text" name="search" class="form-control" id="emailLogin"
                                       disabled="disabled" style="text-align: center;margin-top: 5%">
                                <input type="text" name="search" class="form-control" id="password"
                                       placeholder="--请输入授权码--" style="text-align: center;margin-top: 5%">
                            </li>
                            <li class="footer" style="text-align: center;margin-top: 5%">
                                <button type="button" class="btn btn-primary btn-outline btn-rounded"
                                        id="emailLoginButton">登录
                                </button>
                            </li>
                        </ul>
                    </li>


                    <!--收信箱-->
                    <li class="dropdown messages-menu"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i
                            class="icon-megaphone"></i>
                        <div class="notify"><span class="heartbit noticePoint"></span> <span
                                class="point noticePoint"></span></div>
                    </a>
                        <ul class="dropdown-menu">
                            <li class="header" style="padding-bottom: 10%">
                                <div>您有<span id="emailNum">0</span>条邮件未读（目前不支持实时的收件箱显示，期待后续更新...）</div>
                            </li>
                            <li>
                                <ul class="menu" id="emailList">
                                    <!--<li><a href="#">-->
                                    <!--<div class="pull-left"><img src="dist/img/img1.jpg" class="img-circle" alt="User Image"></div>-->
                                    <!--<h4>Florence Douglas</h4>-->
                                    <!--<p>Lorem ipsum dolor sit amet.</p>-->
                                    <!--<p><small><i class="fa fa-clock-o"></i> 2 mins</small></p>-->
                                    <!--</a></li>-->
                                    <!--<li><a href="#">-->
                                    <!--<div class="pull-left"><img src="dist/img/img2.jpg" class="img-circle" alt="User Image"></div>-->
                                    <!--<h4>Douglas Smith</h4>-->
                                    <!--<p>Lorem ipsum dolor sit amet.</p>-->
                                    <!--<p><small><i class="fa fa-clock-o"></i> 15 mins</small></p>-->
                                    <!--</a></li>-->
                                    <!--<li><a href="#">-->
                                    <!--<div class="pull-left"><img src="dist/img/img3.jpg" class="img-circle" alt="User Image"></div>-->
                                    <!--<h4>Lorence Deo</h4>-->
                                    <!--<p>Lorem ipsum dolor sit amet.</p>-->
                                    <!--<p><small><i class="fa fa-clock-o"></i> 35 mins</small></p>-->
                                    <!--</a></li>-->
                                    <!--<li><a href="#">-->
                                    <!--<div class="pull-left"><img src="dist/img/img1.jpg" class="img-circle" alt="User Image"></div>-->
                                    <!--<h4>Florence Douglas</h4>-->
                                    <!--<p>Lorem ipsum dolor sit amet.</p>-->
                                    <!--<p><small><i class="fa fa-clock-o"></i> 2 mins</small></p>-->
                                    <!--</a></li>-->
                                </ul>
                            </li>
                            <li class="footer" style="text-align: center;padding-top: 10%">
                                <button disabled="disabled" id="writeEmail" type="button" id="writeEmail"
                                        class="btn btn-default btn-outline" style="margin-right: 10%">写邮件
                                </button>
                                <button disabled="disabled" id="enterEmail" type="button"
                                        class="btn btn-default btn-outline">进入邮箱
                                </button>
                            </li>
                        </ul>
                    </li>

                    <!--右侧头像框-->
                    <li class="dropdown user user-menu"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img
                            src="dist/img/img1.jpg" class="user-image" alt="User Image"> <span class="hidden-xs"><span
                            class="adminName">Florence Douglas</span></span> </a>
                        <ul class="dropdown-menu">
                            <li class="user-header">
                                <div class="pull-left user-img"><img src="dist/img/img1.jpg" class="img-responsive"
                                                                     alt="User"></div>
                                <p class="text-left"><span class="adminName">Florence Douglas</span>
                                    <small id="email">florence@gmail.com</small>
                                </p>
                                <div class="view-link text-left"><a href="#">个人信息</a></div>
                            </li>
                            <li><a href="#"><i class="icon-gears"></i> 账号设置</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="adminOut"><i class="fa fa-power-off"></i> <span id="adminOut">退出登录</span></a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>

  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar dark-bg">
    <section class="sidebar">
      <div class="user-panel black-bg">
        <div class="pull-left image"> <img src="dist/img/img1.jpg" class="img-circle" alt="User Image"> </div>
        <div class="pull-left info">
          <p class="adminName">Florence Douglas</p>
          <a href="#"><i class="fa fa-circle"></i> Online</a> </div>
      </div>
      <!-- Sidebar Menu -->
      <ul class="sidebar-menu" data-widget="tree">
        <li class="header dark-bg">Menu</li>
        <li class="treeview active"><a href="#"><i class="fa fa-dashboard"></i> <span>数据详情</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a>
            <ul class="treeview-menu ">
                <li><a href="index.html"><i class="fa fa-angle-right"></i> 后台数据概览</a></li>
                <li class="active"><a href="getMoreTodayFund.html"><i class="fa fa-angle-right"></i> 今日众筹数据</a></li>
                <!--<li><a href="dashboard-3.html"><i class="fa fa-angle-right"></i> 数据详情 3</a></li>-->
            </ul>
        </li>
        <li class="treeview"> <a href="#"><i class="fa fa-table"></i> <span>权限管理</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a>
          <ul class="treeview-menu">
            <li><a href="userManage.html"><i class="fa fa-angle-right"></i> 用户管理</a></li>
            <li><a href="adminManage.html"><i class="fa fa-angle-right"></i> 管理员管理</a></li>
            <li><a href="goodManage.html"><i class="fa fa-angle-right"></i> 商品管理</a></li>
          </ul>
        </li>
      </ul>
      <!-- sidebar-menu -->
    </section>
  </aside>

  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"> 
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>今日众筹数据</h1>
      <ol class="breadcrumb">
        <li><a href="index.html"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active"><i class="fa fa-dashboard"></i> 今日众筹数据</li>
      </ol>
    </section>
    
    <!-- Main content -->
    <section class="content container-fluid">
      <div class="row">
        <div class="col-lg-3 col-xs-6">
          <div class="media-box plain">
            <div class="media-icon pull-left"><i class="icon-bargraph"></i> </div>
            <div class="media-info">
              <h3><span id="todayTotalGood">1530</span>件</h3>
              <h4>今日获筹项目数</h4>
            </div>
          </div>
        </div>
        <div class="col-lg-3 col-xs-6">
          <div class="media-box plain">
            <div class="media-icon bg-sea pull-left"><i class="icon-wallet"></i> </div>
            <div class="media-info">
              <h3>￥&nbsp<span id="todayTotalMoney">8,530</span>元</h3>
              <h4>今日共获得筹金</h4>
            </div>
          </div>
        </div>
        <div class="col-lg-3 col-xs-6">
          <div class="media-box plain">
            <div class="media-icon bg-blue pull-left"><i class="icon-basket"></i> </div>
            <div class="media-info">
              <h3><span id="todayFundPeople">655</span>人</h3>
              <h4>今日捐款人数</h4>
            </div>
          </div>
        </div>
        <div class="col-lg-3 col-xs-6">
          <div class="media-box plain">
            <div class="media-icon bg-green pull-left"><i class="icon-layers"></i> </div>
            <div class="media-info">
              <h3><span id="todayEntryPeople">655</span>人</h3>
              <h4>今日访客人数</h4>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
            <div class="col-lg-12">
                <div class="chart-box">
                    <h4>今天的众筹情况</h4>
                    <div class="table-responsive">
                        <table class="table table-responsive">
                            <thead style="font-size: 140%">
                            <tr>
                                <th>项目名</th>
                                <th style="text-align: center">总获筹金额</th>
                                <th style="text-align: center">筹款进度</th>
                                <th style="text-align: center">今日获筹金额</th>
                                <th style="text-align: center">所属用户</th>
                            </tr>
                            </thead>
                            <tbody style="font-size: 130%">
                            <!--<tr>-->
                                <!--<td class="text-truncate">OV-101777</td>-->
                                <!--<td class="text-truncate" style="text-align: center"><a href="#">VIO-0035421</a></td>-->
                                <!--<td class="text-truncate" style="text-align: center">$ 653.00</td>-->
                                <!--<td class="text-truncate" style="text-align: center">668</td>-->
                                <!--<td class="text-truncate" style="text-align: center"><a href="#">Florence Douglas</a></td>-->
                            <!--</tr>-->
                            </tbody>
                            <!--<tfoot>-->
                            <!--<tr>-->
                                <!--<td align="center" colspan="5">-->
                                    <!--<ul class="pagination pagination-lg" align="center">-->
                                        <!--<li><a aria-label="Previous"> <span aria-hidden="true">&laquo;</span> </a> </li>-->
                                        <!--<li><a id="pageOne">1</a></li>-->
                                        <!--<li><a id="pageTwo">2</a></li>-->
                                        <!--<li><a id="pageThree">3</a></li>-->
                                        <!--<li><a id="pageFour">4</a></li>-->
                                        <!--<li><a id="pageFive">5</a></li>-->
                                        <!--<li> <a aria-label="Next"> <span aria-hidden="true">&raquo;</span> </a> </li>-->
                                    <!--</ul>-->
                                <!--</td>-->
                            <!--</tr>-->
                            <!--</tfoot>-->
                        </table>
                    </div>
                </div>
            </div>
        </div>
      <div class="row">
        <div class="col-lg-12">
          <div class="chart-box">
            <h4>24小时内众筹情况</h4>
            <div class="chart">
              <div id="container2"></div> 
            </div>
          </div>
        </div>
      </div>
    </section>
    <!-- content --> 
  </div>
  <!-- content-wrapper --> 
  
  <!-- Main Footer -->
  <footer class="main-footer dark-bg">
    <div class="pull-right hidden-xs"> Version 1.0</div>
    Copyright &copy; 2017 Yourdomian. All rights reserved. </footer>
</div>
<!-- wrapper -->

<!--隐藏域-->
<div id="moneyInThisHour">
<!--<input type="hidden" id="moneyInThisHour" value="">-->
</div>
<div id="numInThisHour">
<!--<input type="hidden" id="numInThisHour">-->
</div>




<!-- jQuery --> 
<script src="dist/js/jquery.min.js"></script> 
<script src="bootstrap/js/bootstrap.min.js"></script> 
<script src="dist/js/ovio.js"></script> 

<!--charts-->
<script src="plugins/charts/code/modules/exporting.js"></script>
<script type="text/javascript" src="adminCommon.js"></script>
<script type="text/javascript">
    $(function () {
        function selectHourToArray(hour,money,goodNumInHour,goodMoneyInHour){
            for (var i = 0; i <24; i++) {
                if (i==Number(hour)){
                    goodNumInHour[i]++;
                    goodMoneyInHour[i]+=Number(money);
                    break;
                }
            }
        }

        function compareGoodId(tempGoodId,goodId){
            if (tempGoodId.length==0){
                tempGoodId.push(goodId);
                return false;
            }

            for (var i = 0; i <tempGoodId.length ; i++) {
                if(goodId==tempGoodId[i]){
                    return true;
                }
            }
            tempGoodId.push(goodId);
            return false;
        }


        $.post("indexTodayInf", function (resultEntity) {
            if (resultEntity.resultFlag == true) {

                var tbodyHtml = "";
                var length = resultEntity.data.goodList.length;

                $("#todayFundPeople").text(resultEntity.data.getFundNum);
                $("#todayTotalMoney").text(resultEntity.data.getTotalMoney);



                var goodNumInHour = [
                    0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0
                ];
                var goodMoneyInHour = [
                    0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0
                ];

                var length0=0;
                var tempGoodId = new Array();
                for (var i = length-1; i >=0; i--) {
                    var currentAmount = Number(resultEntity.data.goodList[i].currentAmount);
                    var targetAmount = Number(resultEntity.data.goodList[i].targetAmount);
                    var completionRate = Math.floor(currentAmount / targetAmount * 10000) / 100;
                    var hour = JSON.stringify(resultEntity.data.goodList[i].fundTime).split(":")[0].substring(1);
                    var money = JSON.stringify(resultEntity.data.goodList[i].todayGetMoney);
                    selectHourToArray(hour, money, goodNumInHour, goodMoneyInHour);


                    var goodId = Number(JSON.stringify(resultEntity.data.goodList[i].goodId));
                    var flag = compareGoodId(tempGoodId,goodId);
                    if (flag == true) {
                        continue;
                    }

                    tbodyHtml += "<tr>\n" +
                        "                      <td class=\"text-truncate\">" + resultEntity.data.goodList[i].goodName + "</td>\n" +
                        "                      <td class=\"text-truncate\" style=\"text-align: center\"><a href=\"goodDetail.html?primaryKey=" + resultEntity.data.goodList[i].goodId + "\">" + resultEntity.data.goodList[i].currentAmount + "</a></td>\n" +
                        "                      <td class=\"text-truncate\" style=\"text-align: center\">" + completionRate + " %</td>\n" +
                        "                      <td class=\"text-truncate\" style=\"text-align: center\">" + resultEntity.data.goodList[i].todayGetMoney + " 元</td>\n" +
                        "                      <td class=\"text-truncate\" style=\"text-align: center\"><a href=\"userDetail.html?primaryKey=" + resultEntity.data.goodList[i].userId + "\">" + resultEntity.data.goodList[i].userName + "</a></td>\n" +
                        "                    </tr>";

                    length0++;
                }
                $("#todayTotalGood").text(length0);
                $("tbody").html(tbodyHtml);

                var moneyInHour="";
                var numInHour="";
                for (var i = 0; i <24 ; i++) {
                    moneyInHour+="<input type=\"hidden\" id=\""+i+"-moneyInThisHour\" value=\""+goodMoneyInHour[i]+"\">";
                    numInHour+="<input type=\"hidden\" id=\""+i+"-numInThisHour\" value=\""+goodNumInHour[i]+"\">";
                }
                $("#moneyInThisHour").html(moneyInHour);
                $("#numInThisHour").html(numInHour);

                setTimeout("delayLoadScript()",100);
            }else {
                layer.msg("今日获筹信息获取失败，请刷新...")
            }
        });


        $.post("todayVisotor",function (resultEntity) {
            if (resultEntity.resultFlag == true) {
                $("#todayEntryPeople").text(resultEntity.data);
            }else {
            }
        });
        // setTimeout("delayLoadScript()",1000);

    });
    function delayLoadScript() {
        var script = document.createElement('script');
        script.src = "dist/js/getMoreToday.js";
        document.body.appendChild(script);
    }
</script>
</body>
</html>